<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>编辑《 [[${book.name}]]》</title>
    <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}">
    <script th:src="@{/js/jquery-3.2.1.js}"></script>
    <script th:src="@{/js/bootstrap.min.js}"></script>
    <style>
        body {
            background-color: rgb(240, 242, 245);
        }
    </style>

</head>
<body>
<div th:replace="components/adminPublicComponents::topbar"></div>

<div class="col-xs-6 col-md-offset-3" style="position: relative;margin-top: 5%">
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">编辑《 [[${book.name}]]》</h3>
        </div>
        <div class="panel-body">
            <form th:action="@{/bookEditDo(bookId=${book.bookId})}" method="post" id="addbook">
                <div class="input-group">
                    <span class="input-group-addon">书名</span>
                    <input type="text" class="form-control" name="name" id="name" th:value="${book.name}">
                </div>
                <div class="input-group">
                    <span class="input-group-addon">作者</span>
                    <input type="text" class="form-control" name="author" id="author" th:value="${book.author}">
                </div>
                <div class="input-group">
                    <span class="input-group-addon">出版社</span>
                    <input type="text" class="form-control" name="publish" id="publish" th:value="${book.publish}">
                </div>
                <div class="input-group">
                    <span class="input-group-addon">ISBN</span>
                    <input type="text" class="form-control" name="isbn" id="isbn" th:value="${book.isbn}">
                </div>
                <div class="input-group">
                    <span class="input-group-addon">简介</span>
                    <input type="text" class="form-control" name="introduction" id="introduction"
                           th:value="${book.introduction}">
                </div>
                <div class="input-group">
                    <span class="input-group-addon">语言</span>
                    <input type="text" class="form-control" name="language" id="language" th:value="${book.language}">
                </div>
                <div class="input-group">
                    <span class="input-group-addon">价格</span>
                    <input type="text" class="form-control" name="price" id="price" th:value="${book.price}">
                </div>
                <div class="input-group">
                    <span class="input-group-addon">出版日期</span>
                    <input type="text" class="form-control" name="pubdate" id="pubdate" th:value="${book.pubdate}">
                </div>
                <div class="input-group">
                    <span class="input-group-addon">分类号</span>
                    <input type="text" class="form-control" name="classId" id="classId" th:value="${book.classId}">
                </div>
                <div class="input-group">
                    <span class="input-group-addon">书架号</span>
                    <input type="text" class="form-control" name="pressmark" id="pressmark" th:value="${book.pressmark}">
                </div>
                <div class="input-group">
                    <span class="input-group-addon">状态</span>
                    <input type="text" class="form-control" name="state" id="state" th:value="${book.state}">
                </div>
                <input type="submit" value="确定" class="btn btn-success btn-sm text-left">
                <script>
                    function mySubmit(flag) {
                        return flag;
                    }

                    $("#addbook").submit(function () {
                        if ($("#name").val() == '' || $("#author").val() == '' || $("#publish").val() == '' || $("#isbn").val() == '' || $("#introduction").val() == '' || $("#language").val() == '' || $("#price").val() == '' || $("#pubdate").val() == '' || $("#classId").val() == '' || $("#pressmark").val() == '' || $("#state").val() == '') {
                            alert("请填入完整图书信息！");
                            return mySubmit(false);
                        }
                    })
                </script>
            </form>
        </div>
    </div>

</div>

</body>
</html>
